<?php $this->load->view($config['site_template'].'/head');?>
<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInUp">
        <div class="row">
            <div class="col-sm-12">

                <div class="ibox">
                    <div class="ibox-title">
                        <h5><?php if($catalog):?><?=$catalog['name']?><?php else:;?>所有列表<?php endif;?></h5>
                        <!--
                        <div class="ibox-tools">
                            <a href="projects.html" class="btn btn-primary btn-xs">创建新项目</a>
                        </div>
                        -->
                    </div>
                    <div class="ibox-content">
                        <!--
                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-1">
                                <button type="button" id="loading-example-btn" class="btn btn-white btn-sm"><i class="fa fa-refresh"></i> 刷新</button>
                            </div>
                            <div class="col-md-11">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入异常问题描述" class="input-sm form-control"> <span class="input-group-btn">
                                        <button type="button" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                        </div>
                        -->
                        <div class="project-list">

                            <table class="table table-hover">
                                <tbody>
                                    <tr>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">序号</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">异常问题描述</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">异常问题截图</a>
                                        </td>
                                        <td class="project-title">
                                            <a href="javascript:void(0)">报错原因</a>
                                        </td>
                                        <td class="project-title" style="text-align: right;">
                                            <a href="javascript:void(0)">操作</a>
                                        </td>
                                    </tr>
                                    <?php foreach ($list as $value):?>
                                    <tr>
                                        
                                        <td class="project-status">
                                            <span class="label label-primary"><?=$value['lid']?>
                                        </td>
                                        <td class="project">
                                            <?=$value['title']?>
                                        </td>
                                        <td class="social-avatar">
                                            <a href="javascript:void(0)">
                                                <?php if(strlen($value['thumb'])  > 0):?>
                                                <img alt="image" class="img" src="<?=  base_url().$value['thumb']?>">
                                                <?php endif;?>
                                            </a>
                                        </td>
                                        <td class="project">
                                            <?=$value['description']?>
                                        </td>
                                        
                                        
                                        <td class="project-actions">
                                            <a href="javascript:void(0)" class="btn btn-white btn-sm showOrder"><input type="hidden" name="id" value="<?=$value['id']?>"><i class="fa fa-folder"></i> 查看 </a>
                                            <!--<a href="projects.html#" class="btn btn-white btn-sm"><i class="fa fa-pencil"></i> 编辑 </a>-->
                                        </td>
                                       
                                    </tr>
                                    <?php endforeach;?>
                                    </tbody>
                                    
                                    
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <script>
       $(document).ready(function() {
            $("#loading-example-btn").click(function() {
                btn = $(this);
                simpleLoad(btn, true);
                simpleLoad(btn, false)
            })
            $('.img').click(function(){
                var src = $(this).attr("src")
                $("#thumb").attr('src',src);
                $(".showThumb").click();
            });
            $(".showOrder").click(function(){
                var id = $(this).find("[name=id]").val();
                $.ajax({
                    type:"GET",
                    url:'<?=base_url("article/articleContent?id=")?>'+id,
                    dataType: "json",
                    success:function(data){
                        console.log(data.thumb.length);
                        if(data.thumb.length > 0){
                            $("#thumb_show").html('<img src="<?=  base_url()?>'+data.thumb+'" class="img-responsive" alt="Cinque Terre">');
                        }else{
                            $("#thumb_show").html('');
                        }
                        if(data.title.length > 0){
                            $("#title").html(data.title);
                        }else{
                            $("#title").html("");
                        }
                        if(data.description.length > 0){
                            $("#description").html(data.description);
                        }else{
                            $("#description").html("");
                        }
                        if(data.content.length > 0){
                            $("#content").html(data.content);
                        }else{
                            $("#content").html("");
                        }
                        $(".showAbnormalQas").click();
                    }
                    
                })
            })
        });
        function simpleLoad(btn, state) {
            if (state) {
                btn.children().addClass("fa-spin");
                btn.contents().last().replaceWith(" Loading")
            } else {
                setTimeout(function() {
                    btn.children().removeClass("fa-spin");
                    btn.contents().last().replaceWith(" Refresh")
                },
                2000)
            }
        };
    
        $(function () { $('#imgShow').modal('hide')});
        $(function () { $('#imgShow').on('hide.bs.modal', function () {
           //alert('嘿，我听说您喜欢模态框...');
           })
        });
    </script>
    
    </body>
    <!--异常问题截图展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showThumb" style="display: none" data-toggle="modal" data-target="#imgShow">
            演示图片模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="imgShow" tabindex="-1" role="dialog" aria-labelledby="imgShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="imgShowLabel">
                                        异常问题截图
                                    </h4>
                            </div>
                            <div class="modal-body">
                                    <img id="thumb" src="" class="img-responsive" alt="Cinque Terre"> 
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
    
    <!--异常问题详细内容展示-->
    <!-- 按钮触发模态框 -->
    <button class="btn btn-primary btn-lg showAbnormalQas" style="display: none" data-toggle="modal" data-target="#AbnormalQasShow">
            异常问题详细模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="AbnormalQasShow" tabindex="-1" role="dialog" aria-labelledby="AbnormalQasShowLabel" aria-hidden="true">
            <div class="modal-dialog">
                    <div class="modal-content">
                            <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×
                                    </button>
                                    <h4 class="modal-title" id="AbnormalQasShowLabel">
                                        异常问题截图
                                    </h4>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label>异常问题描述</label>
                                    <div id="title" class="well well-lg"></div>

                                </div>
                                <div class="form-group">
                                    <label>异常问题截图</label>
                                    <div id="thumb_show" class="well well-lg">11</div>

                                </div>
                                <div class="form-group">
                                    <label>问题原因</label>
                                    <div id="description" class="well well-lg">11</div>

                                </div>
                                <div class="form-group">
                                    <label>解决办法</label>
                                    <div id="content" class="well well-lg"></div>

                                </div>
                            </div>
                            <div class="modal-footer">
                                    <button type="button" class="btn btn-primary" data-dismiss="modal">
                                            关闭
                                    </button>
                            </div>
                    </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
<?php $this->load->view($config['site_template'].'/foot');?>